import React, { useCallback } from 'react';
import { useStore, useDispatch } from 'dva';
import styles from './try_redux_middleware.css';

export default function try_redux_middleware() {
  const store = useStore();
  const state = store.getState();
  console.log(store);
  console.log(state.product);
  const dispatch = useDispatch();
  const doChangeSome = useCallback(() => {
    console.log('dispatching');
    dispatch({ type: 'dummy' });
  }, []);
  return (
    <div className={styles.normal}>
      <h1>Page try_redux_middleware</h1>
      <button onClick={doChangeSome}>dispatch</button>
    </div>
  );
}
